using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using XLua;

//所有实体的通用逻辑脚本
//与ui逻辑类似
public class EntityLogic : LuaBehaviour
{
    Action m_LuaOnShow;
    Action m_LuaOnHide;


    public override void Init(string luaName)
    {
        base.Init(luaName);
       m_ScriptEnv.Get("OnShow",out m_LuaOnShow);
        //不会直接销毁，由于资源需要重复利用，因此是要隐藏
       m_ScriptEnv.Get("OnHide", out m_LuaOnHide);
    }

    public void OnShow()
    {
        m_LuaOnShow?.Invoke();
    }
    public void OnHide()
    {
        m_LuaOnHide?.Invoke();
    }

    protected override void Clear()
    {
        m_LuaOnShow = null;
        m_LuaOnHide = null;
        base.Clear();
    }
}
